package com.huarui.task.status;

import java.util.Collection;

import org.apache.commons.collections.MultiHashMap;
import org.apache.commons.collections.MultiMap;

public class StatusTree {

	private MultiMap parent2child = new MultiHashMap();
	private MultiMap child2parent = new MultiHashMap();

	final static public Status ROOT = new Status("_ROOT_");

	public void append(String parent, String child) {

		parent2child.put(parent, child);
		child2parent.put(child, parent);

	}

	@SuppressWarnings("unchecked")
	public Collection<String> getChildren(String status) {

		return (Collection<String>) parent2child.get(status);

	}

	@SuppressWarnings("unchecked")
	public Collection<String> getParents(String status) {
		return (Collection<String>) child2parent.get(status);
	}
}
